.switch {
    -webkit-appearance: none;
    appearance: none;
}
.switch,
.switch-cp__box {
    position: relative;
    width: 52px;
    height: 26px;
    border: 1px solid #DFDFDF;
    outline: 0;
    border-radius: 16px;
    box-sizing: border-box;
    background-color: #DFDFDF;
    -webkit-transition: background-color 0.1s, border 0.1s;
    transition: background-color 0.1s, border 0.1s;
}
.switch:before,
.switch-cp__box:before {
    content: " ";
    position: absolute;
    top: 0;
    left: 0;
    width: 50px;
    height: 24px;
    border-radius: 12px;
    background-color: #FDFDFD;
    -webkit-transition: -webkit-transform 0.35s cubic-bezier(0.45, 1, 0.4, 1);
    transition: -webkit-transform 0.35s cubic-bezier(0.45, 1, 0.4, 1);
    transition: transform 0.35s cubic-bezier(0.45, 1, 0.4, 1);
    transition: transform 0.35s cubic-bezier(0.45, 1, 0.4, 1), -webkit-transform 0.35s cubic-bezier(0.45, 1, 0.4, 1);
}
.switch:after,
.switch-cp__box:after {
    content: " ";
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    border-radius: 12px;
    background-color: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    -webkit-transition: -webkit-transform 0.35s cubic-bezier(0.4, 0.4, 0.25, 1.35);
    transition: -webkit-transform 0.35s cubic-bezier(0.4, 0.4, 0.25, 1.35);
    transition: transform 0.35s cubic-bezier(0.4, 0.4, 0.25, 1.35);
    transition: transform 0.35s cubic-bezier(0.4, 0.4, 0.25, 1.35), -webkit-transform 0.35s cubic-bezier(0.4, 0.4, 0.25, 1.35);
}
.switch:checked,
.switch-cp__input:checked ~ .switch-cp__box {
    border-color: #04BE02;
    background-color: #04BE02;
}
.switch:checked:before,
.switch-cp__input:checked ~ .switch-cp__box:before {
    -webkit-transform: scale(0);
    transform: scale(0);
}
/*~~相同父元素下,选中前一个选择器后面所有的后一个选择器元素*/
.switch:checked:after,
.switch-cp__input:checked ~ .switch-cp__box:after {
    -webkit-transform: translateX(26px);
    transform: translateX(26px);
}
.switch-cp__input {
    position: absolute;
    left: -9999px;
}
.switch-cp__box {
    display: block;
}